package com.future.config;

import com.future.dto.BaiDuAIRequestInfoDto;
import com.future.dto.ImgBasePathDto;
import com.future.dto.YSOpenRequestInfoDto;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * 项目的基本配置
 */
@Configuration
public class BasicConfig {

    @Bean
    public BaiDuAIRequestInfoDto baiDuAIRequestInfoDto() {
        BaiDuAIRequestInfoDto requestInfoDto = new BaiDuAIRequestInfoDto();

        requestInfoDto.setGetURLOfAccessToken("https://aip.baidubce.com/oauth/2.0/token");
        // grant_type为固定参数
        requestInfoDto.setGetGrantTypeOfAccessToken("client_credentials");

        requestInfoDto.setAPIKey("IDUGjIFFeY9H47cYdhKHOF2R");
        requestInfoDto.setSecretKey("eedbod2Q2hQoQI36tvqXiZA4WAlMd3mb");

        requestInfoDto.setURLOfHumanBodyDetection("https://aip.baidubce.com/rest/2.0/image-classify/v1/body_attr");

        requestInfoDto.setURLOfDrivingBehavior("https://aip.baidubce.com/rest/2.0/image-classify/v1/driver_behavior");

        return requestInfoDto;
    }

    @Bean
    public YSOpenRequestInfoDto ysOpenRequestInfoDto() {
        YSOpenRequestInfoDto requestInfoDto = new YSOpenRequestInfoDto();

        requestInfoDto.setGetURLOfAccessToken("https://open.ys7.com/api/lapp/token/get");
        requestInfoDto.setAppKeyOfYSOpen("5f5ee2ea1c344cdfbf90efaa5f0743f3");
        requestInfoDto.setAppSecretOfYSOpen("2501ee32e3e7d6175cb75c14eac3cd32");

        /**
         * 设备默认序列号
         */
        requestInfoDto.setDeviceSerial("J74318913");
        requestInfoDto.setChannelNo(1);

        requestInfoDto.setURLOfCapture("https://open.ys7.com/api/lapp/device/capture");

        return requestInfoDto;
    }

    @Bean
    public ImgBasePathDto imgBasePath() {
        ImgBasePathDto pathDto = new ImgBasePathDto();

        pathDto.setRootPath("C:/images");
        pathDto.setPublicMonitorPath(pathDto.getRootPath() + "/monitor/public");
        pathDto.setDrivingMonitorPath(pathDto.getRootPath() + "/monitor/driving");
        pathDto.setUserInfoPath(pathDto.getRootPath() + "/user");

        return pathDto;
    }
}
